<?php

use yii\db\Migration;

/**
 * Class m191014_074735_project_actor
 */
class m191014_074735_project_actor extends Migration
{
    /**
     * {@inheritdoc}
     */
    public function safeUp()
    {
        $tableOptions = 'CHARACTER SET utf8 COLLATE utf8_general_ci ENGINE=InnoDB COMMENT="演职人员"';
        $this->createTable('{{%project_actor}}', [
            'id' => $this->primaryKey(),
            'name'=>$this->string()->notNull()->comment('姓名'),
            'position' => $this->string()->notNull()->comment('职位'),
            'role' => $this->string()->notNull()->comment('角色'),
            'sort' => $this->integer()->notNull()->defaultValue(50)->comment('排序'),
            'avatar' => $this->string()->notNull()->comment('角色头像'),
            'project_id'=>$this->integer()->notNull()->comment('项目id'),
            'created_at' => $this->integer()->notNull(),
            'updated_at' => $this->integer()->notNull(),
            'deleted_at' => $this->integer(),
        ],$tableOptions);
    }

    /**
     * {@inheritdoc}
     */
    public function safeDown()
    {
        $this->dropTable('{{%project_actor}}');
        return false;
    }

    /*
    // Use up()/down() to run migration code without a transaction.
    public function up()
    {

    }

    public function down()
    {
        echo "m191014_074735_project_actor cannot be reverted.\n";

        return false;
    }
    */
}
